<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>评论链接</title>
    <link href="../../css/admin/style.css" rel="stylesheet" type="text/css" />
    <script src="../../js/jquery-1.8.3.min.js" type="text/javascript"></script >
    <script>
        $(function (){
            $.get("../../comment/getcommentlist",{state:0},function (res){
                if (res.code == 202){
                    window.parent.location.replace("../login.html");
                }else if (res.code == 500){
                    alert(res.msg);
                }else {
                    var str="";
                    for (let i = 0; i < res.data.length; i++) {
                        str += "<tr align='center'>";
                        str += "<td>"+(i+1)+"</td>"
                        str+="<td>"+res.data[i].content+"</td>";
                        str+="<td>"+(new Date(res.data[i].commentTime).toLocaleString())+"</td>";
                        str+="<td>"+res.data[i].user.account+"</td>";
                        str+="<td>"+res.data[i].journalism.title+"</td>";
                        str+="<td>"
                        if (res.data[i].state == 0){
                            str+="提交"
                        }else if (res.data[i].state == 1){
                            str+="通过"
                        }else {
                            str+="未通过"
                        }
                        str+="</td>"
                        str+="<td><a href='javaScript:void(0)' onclick='toexamine("+res.data[i].id+")' class='tablelink'>审核</a></td> "
                        str+="</tr>";
                    }
                    $("#tableId").append(str);
                }
            },"json")
        })

        function toexamine(id){
            location.assign("toExamine.html?id="+id);
        }
    </script>
</head>
<body>
<div class="rightinfo">

    <!--数据列表 -->
    <table class="tablelist" id="tableId">
        <tr>
            <th >id</th>
            <th >评论内容</th>
            <th >评论时间</th>
            <th >评论人</th>
            <th >文章</th>
            <th >评论状态</th>
            <th >操作</th>
        </tr>

    </table>
</div>
</body>
</html>